﻿using Susha.Models.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Susha.Models
{
    public class Category
    {
        private IList<Sushi> _sushis;
        public virtual Int32 Id { get; set; }
        public virtual String Name { get; set; }

        public virtual IList<Sushi> Sushi
        {
            get
            {
                if (_sushis == null)
                {
                    _sushis = SushiRepository.GetSushiByCategory(this.Id);
                }
                return _sushis;
            }
            set
            {
                _sushis = value;
            }
        }

        public virtual Int32 GetSushiCount()
        {
            return Sushi.Count;
        }
    }
}